<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<link href="${pageContext.request.contextPath}/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />

<script type="text/javaScript"> 
if (window != top) 
top.location.href = location.href; 
</script> 

<title>首页</title>
</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value="" />
<div class="header"></div>
<div class="loginWraper">
  <div id="loginform" class="loginBox">
    <form class="form form-horizontal" action="./login_validate" onsubmit="return check()" method="post">
    <div class="row cl">
        <label class="form-label col-xs-3">${error} </label>
        
      </div>
    
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
        <div class="formControls col-xs-8">
          <input id="user_id" name="user_id" type="text" placeholder="账户" class="input-text size-L">
        </div>
      </div>
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
        <div class="formControls col-xs-8">
          <input id="user_pass" name="user_pass" type="password" placeholder="密码" class="input-text size-L">
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input class="input-text size-L" id="randomCode" name="randomCode" type="text" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}" onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;">
          <img id="code_img" src="${pageContext.request.contextPath}/randomcode.jpg"> <a id="kanbuq" href="#" onclick="replaceCode()">看不清，换一张</a> </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <label for="online">
            <input type="checkbox" name="online" id="online" value="">
            使我保持登录状态</label>
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input name="" type="submit" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
          <input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
        </div>
      </div>
    </form>
  </div>
</div>
<div class="footer">Copyright 你的公司名称 by H-ui.admin v3.1</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/jsencrypt.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/public.js"></script>
 
 <script type="text/javascript">
 	function replaceCode() {
 		var timestamp = new Date().getTime();  
 		//document.getElementById().src='${pageContext.request.contextPath}/randomcode.jpg';
 		$("#code_img").attr('src',$("#code_img").attr('src') + '?'+ timestamp);
 	}
 	
 	
	function check() {
		
	 
		var userName = $("#user_id").val();
		   
		if(userName == null || userName == '') {
			 alert("用户名为空");   
			 return false;
		}
		var pass = $("#user_pass").val();
		if(pass == null || pass == '') {
			 alert("密码为空");   
			 return false;
		}
		var pat=new RegExp("[^a-zA-Z0-9\_\u4e00-\u9fa5]","i");   
		   
	      if(pat.test(userName)==true)   
	      {   
	          alert("用户名中含有非法字符");   
	          return false;   
	      }  
	      //判断验证码
	     var randomCode = $("#randomCode").val();
		if(randomCode == null || randomCode == '') {
			 alert("验证码为空");   
			 return false;
		}
	      
	  	var new_pass = encrypt(pass);
	  	 
		$("#user_pass").val(new_pass);
	      
	      
		return true;
		
	}
	
 	
 </script>
 
</body>
</html>